Skip to content

The model is not quite aware about the tools #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vladimirovpv opened this issue Jan 16, 2025 · 3 comments
Open

The model is not quite aware about the tools #10

vladimirovpv opened this issue Jan 16, 2025 · 3 comments

Comments

@vladimirovpv
Copy link

vladimirovpv commented Jan 16, 2025

I was able to configure and run mcphost with qwen2.5-coder. The model was able to list all the available tools but it was not informed in which situation to use them. I asked the model to write a simple Python code and save it to a file. The model has written the code, but instead of saving it to a file it provided me with another Python script that would save the first Python script to a file. So the model is not aware that it can access a specific tool for this purpose until I mention it explicitly. The last failure to write the file was due to misconfiguration of the allowed path for the filesystem server.

It seems that some information on that should be added to the system prompt during registration of tools.

Here is a complete log of the run.
`> mcphost --model ollama:qwen2.5-coder:7b-instruct
2025/01/16 12:52:08 INFO Model loaded provider=ollama model=qwen2.5-coder:7b-instruct
2025/01/16 12:52:08 INFO Initializing server... name=sqlite
2025/01/16 12:52:09 INFO Initializing server... name=filesystem
2025/01/16 12:52:10 INFO Server connected name=sqlite
2025/01/16 12:52:10 INFO Server connected name=filesystem
2025/01/16 12:52:10 INFO Tools loaded server=sqlite count=6
2025/01/16 12:52:10 INFO Tools loaded server=filesystem count=9

You: Which MCP tools are available to you?

Assistant:

The available tools include:

• sqlite__read_query
• sqlite__write_query
• sqlite__create_table
• sqlite__list_tables
• sqlite__describe_table
• sqlite__append_insight
• filesystem__read_file
• filesystem__read_multiple_files
• filesystem__write_file
• filesystem__create_directory
• filesystem__list_directory
• filesystem__move_file
• filesystem__search_files
• filesystem__get_file_info
• filesystem__list_allowed_directories

You: write a Python code to add all uneven numbers from 1 to 191. Write it to file test_sum.py in the default dir.

Assistant:

To accomplish this task, you can follow these steps:

  1. Create a new Python script named test_sum.py.
  2. Write a function that calculates the sum of all odd numbers from 1 to 191.
  3. Save the content of this function to the test_sum.py file.`

Here is the Python code:

# test_sum.py                                                                                                   
                                                                                                                
def sum_of_odd_numbers():                                                                                       
    total = 0                                                                                                   
    for number in range(1, 192):                                                                                
        if number % 2 != 0:                                                                                     
            total += number                                                                                     
    return total                                                                                                
                                                                                                                
result = sum_of_odd_numbers()                                                                                   
print(f"The sum of all odd numbers from 1 to 191 is: {result}")                                                 

To write this code to the file test_sum.py in the default directory, you can use the following Python script:

# Write the content to test_sum.py                                                                              
                                                                                                                
code_to_write = """                                                                                             
# test_sum.py                                                                                                   
                                                                                                                
def sum_of_odd_numbers():                                                                                       
    total = 0                                                                                                   
    for number in range(1, 192):                                                                                
        if number % 2 != 0:                                                                                     
            total += number                                                                                     
    return total                                                                                                
                                                                                                                
result = sum_of_odd_numbers()                                                                                   
print(f"The sum of all odd numbers from 1 to 191 is: {result}")                                                 
"""                                                                                                             
                                                                                                                
with open('test_sum.py', 'w') as file:                                                                          
    file.write(code_to_write)                                                                                   
                                                                                                                
print("Code has been written to test_sum.py")                                                                   

When you run the second script, it will create test_sum.py in the default directory and write the required Python
code into it.

You: When I ask you to write file I mean: call filesystem__write_file tool and supply dir, file name and it context as args. Now write the code you have just generated to test_sum.py in ~/mcp_workplace.

Assistant:

2025/01/16 13:53:48 INFO 🔧 Using tool name=filesystem__write_file

Assistant:

2025/01/16 14:15:08 INFO 🔧 Using tool name=filesystem__write_file

Assistant:

It seems that the ~/mcp_workplace and its subdirectories are not within the allowed access list. If you have write
permissions to a specific directory, please provide me with the correct path where I can create the file for you.
Otherwise, if you cannot specify a different path, I suggest creating a temporary file in one of the allowed
directories instead.

@aksh1203
Copy link

i faced the same thing. it seems, if mcp server is installed in C: drive then it can access and execute proper file operations., but if you put some other drive apart from C:, it will show that "outside directory..." error.

@EthBerryAdmin
Copy link

EthBerryAdmin commented Mar 15, 2025

I have the same issue with ollama:incept5/llama3.1-claude.
It was asked to list directories but was unable to do so.
Then I tried to play with Slack integration, and it looks like the model sees the tools and even tries to call them but is unable to retrieve the result.

Updated
Slack integration works with the default model but does not work with ollama

@venkatamutyala
Copy link

Could this be a limitation with the model itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants