Skip to content

[Improvement] The constant SEP = "-" may cause "prompt not found" error #297

@codeboyzhou

Description

@codeboyzhou

I noticed that someone created the PR #229 before, but due to absent test case and further communication, it has been closed now.

This problem does exist indeed, I am facing it and also have known how to reproduce it. If the name of MCP server in the fastagent.config.yaml contains the separator -, such as mcp-server-example, it will cause a problem: Prompt not found 'mcp-server-example-my_prompt' on any server, when we select prompt from the [Available MCP Prompts] table. Change the value of constant SEP from - to :, the error message will disappear.

But it's not over yet. We can't replace the - with : simply and directly, because the symbol : will cause another problem: Error applying prompt: Error code: 400 - {'error': {'message': "Invalid 'tools[0].function.name': string does not match pattern. Expected a string that matches the pattern '^+$'.", 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}. I traced back the exception stack, this error message from the underlying openai-sdk, but the root cause is that fast-agent provided invalid prompt name with the symbol :, I guess only letters, digits, and underlines are valid.

I tried to change the value of constant SEP from - to __, two underlines, both of problems above disappeared. But this is not the final decision, I create this issue first to describe the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions